<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>订单显示详情</title>
<style type="text/css">
body {
	font-size: 12px;
	background-image: url("../image/body_bj.jpg");
}

table {
	width: 100%;
	height: auto;
	text-align: center;
}
</style>
</head>
<script type="text/javascript" src="../js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="../js/layer/layer.js"></script>
<body>
	<c:if test="${map.dingdan.status==2||map.dingdan.status==3||map.dingdan.status==4||map.dingdan.status==5}">
		<div style="text-align: center;">
			<h3>
				订单详情
				</h4>
				<hr>
		</div>
		<table>
			<tr>
				<th>菜名</th>
				<th>数量</th>
				<th>状态</th>
			</tr>
			<c:forEach items="${map.dingdan.dingdandetails}" var="x">
				<tr>
					<td>${x.good.goodsName}</td>
					<td>${x.num}</td>
					<!-- 0未制作、1制作中、2已完成、3缺货 4、退菜 -->
					<td><c:if test="${x.status==0}">
						未制作
					</c:if> <c:if test="${x.status==1}">
						制作中
					</c:if> <c:if test="${x.status==2}">
						已完成
					</c:if> <c:if test="${x.status==3}">
						缺货
					</c:if> <c:if test="${x.status==4}">
						退菜
					</c:if></td>
				</tr>
			</c:forEach>
		</table>
	</c:if>
	<c:if test="${map.dingdan.status==0||map.dingdan.status==1}">
		<div style="text-align: center;">
			<h3>
				订单详情
				</h4>
				<hr>
		</div>
		<table>
			<tr>
				<th>菜名</th>
				<th>数量</th>
				<th>状态</th>
				<th>操作</th>
			</tr>
			<c:forEach items="${map.dingdan.dingdandetails}" var="x">
				<tr>
					<td>${x.good.goodsName}</td>
					<td>${x.num}</td>
					<!-- 0未制作、1制作中、2已完成、3缺货 4、退菜 -->
					<td><c:if test="${x.status==0}">
						未制作
					</c:if> <c:if test="${x.status==1}">
						制作中
					</c:if> <c:if test="${x.status==2}">
						已完成
					</c:if> <c:if test="${x.status==3}">
						缺货
					</c:if> <c:if test="${x.status==4}">
						退菜
					</c:if></td>
					<c:if test="${x.status==0}">
						<td><a href="javascript:void(0)" title="退菜" class="tc"
							did="${x.dingdan.dingdanId}" gid="${x.dingdanDT_id}"><img
								src="../image/tuicai.png" width="20px" height="20px"> </a></td>
					</c:if>
				</tr>
			</c:forEach>
		</table>
	</c:if>
	<script type="text/javascript">
	$(function() {
		$(".tc").click(function() {
			var a = $(this).attr("gid");
			var b = $(this).attr("did");
			
			
			//console.log('aaaaaa'+a);
			//console.log('bbbbbbbbb'+b);
				layer.confirm('确定要退菜吗?', {
			btn : [ '确定', '取消' ]
		//按钮
		}, function() {
			$.post("../dingdan/DingDanServlet", {
				dingdanDT_id:a,
				dingdanId:b,
			}, function() {
				location.reload();
				});
			});
		});
		
		
		
	});
</script>
</body>
</html>